<template>
    <div class="input-area">
        <textarea v-model="text" @keyup.ctrl.enter="send" name="input" id="input-area" cols="30" rows="3" placeholder="请输入要发送的内容"></textarea>
    </div>
</template>

<script>
export default {
  data () {
    return {
      text: ''
    }
  },
  methods: {
    // nextLine: function () {
    //   alert('next line')
    // }
    send: function () {
      let msg = {
        to: this.$store.getters.getCurrentChattingId,
        from: this.$store.getters.getMyInfo.id,
        msg: this.text
      }
      console.log(msg)
      // this.$socket.emit('msg-from-client', msg)
      this.$socket.emit('sendMsg', msg)
      this.$set(this.$data, 'text', '')
    }
  }
}
</script>

<style>
.input-area{
    height: 100px;
}
#input-area{
    box-sizing: border-box;
    margin-right: 20px;
    width: 100%;
    height: 100%;
    font-size: 150%;
    resize: none;
    background: whitesmoke;
}
</style>
